package com.chenglu.android.store.adapter;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.common.utils.Utils;
import com.chenglu.android.index.bean.IndexRecomBean;

import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023 10 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：搜索历史
 */
public class RecommendGoodsAdapter extends BaseQuickAdapter<IndexRecomBean.Data.Records, BaseViewHolder> {

    Context context;
//    List<HomeLike.Data.Records> data;
    public RecommendGoodsAdapter(Context context, @Nullable List<IndexRecomBean.Data.Records> data) {
        super(R.layout.item_home_tab_title_data, data);
        this.context = context;

    }


    @Override
    protected void convert(@NonNull BaseViewHolder helper, IndexRecomBean.Data.Records item) {

        if (item == null) {
            return;
        }

            ImageView imageView = helper.getView(R.id.iv_item_src);
            Glide.with(mContext).load(item.getGoodsImg()).into(imageView);

//            GlideUtils.setImageView(mContext,item.getGoodsImg(),imageView,8);
            helper.setText(R.id.tv_item_title,item.getGoodsName());
            helper.setText(R.id.tv_item_des,item.getGoodsDesc());
            helper.setText(R.id.tv_item_price, Utils.formatZeroNumber(item.getGoodsPrice())+"");


    }
}
